﻿using Centny.PdfReader.Font;
using Centny.PdfReader.Types;
using Centny.PdfReader.util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Centny.PdfReader.Graphics
{
    public class PdfTextState : PdfClonable
    {
        public PdfMatrix TextMatrix { get; set; }
        public PdfMatrix LineMatrix { get; set; }
        public PdfName FontName { get; set; }
        public PdfFont Font { get; set; }
        public double HorizontalScaling { get; set; }
        public double Rise { get; set; }
        public double WordSpacing { get; set; }
        public double CharacterSpacing { get; set; }
        public double Leading { get; set; }
        public PdfTextState()
        {
            this.HorizontalScaling = 100;
            this.Rise = this.WordSpacing = this.CharacterSpacing = this.Leading = 0;
            this.TextMatrix = new PdfMatrix();
            this.LineMatrix = new PdfMatrix();
        }

        public Object Clone()
        {
            PdfTextState ts = new PdfTextState();
            ts.TextMatrix = this.TextMatrix.Clone();
            ts.LineMatrix = this.LineMatrix.Clone();
            if (this.FontName != null)
            {
                ts.FontName = new PdfName(this.FontName.Name);
            }
            ts.Font = this.Font;
            ts.HorizontalScaling = this.HorizontalScaling;
            ts.Rise = this.Rise;
            ts.WordSpacing = this.WordSpacing;
            ts.CharacterSpacing = this.CharacterSpacing;
            ts.Leading = this.Leading;
            return ts;
        }
    }
}
